using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLCG.DAO
{
public class tblLinhVucUI
{ 
	private int idLinhVuc;
	public int IdLinhVuc
	{
		get { return idLinhVuc;}
		set { idLinhVuc = value;}
	}

	private String tenLinhVuc;
	public String TenLinhVuc
	{
		get { return tenLinhVuc;}
		set { tenLinhVuc = value;}
	}

	private String maLinhVuc;
	public String MaLinhVuc
	{
		get { return maLinhVuc;}
		set { maLinhVuc = value;}
	}

	private String moTa;
	public String MoTa
	{
		get { return moTa;}
		set { moTa = value;}
	}

	private DateTime ngayTao;
	public DateTime NgayTao
	{
		get { return ngayTao;}
		set { ngayTao = value;}
	}

	public tblLinhVucUI() {}

	public tblLinhVucUI(int idLinhVuc, String tenLinhVuc, String maLinhVuc, String moTa, DateTime ngayTao)
	 {
		this.idLinhVuc = idLinhVuc;
 		this.tenLinhVuc = tenLinhVuc;
 		this.maLinhVuc = maLinhVuc;
 		this.moTa = moTa;
 		this.ngayTao = ngayTao;
 	}

	public int Add(String tenLinhVuc, String maLinhVuc, String moTa, DateTime ngayTao)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblLinhVuc_Add",tenLinhVuc,maLinhVuc,moTa,ngayTao);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idLinhVuc, String tenLinhVuc, String maLinhVuc, String moTa, DateTime ngayTao)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblLinhVuc_Update",idLinhVuc,tenLinhVuc,maLinhVuc,moTa,ngayTao);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idLinhVuc)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblLinhVuc_Delete",idLinhVuc);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblLinhVuc_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idLinhVuc)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblLinhVuc_Get",idLinhVuc);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblLinhVuc_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
